<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

$this->load->helper('html'); ?>



<!-- JavaScript -->
<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />


<div id="container">
<fieldset class="fieldset">
<legend class="legend">

		| Halaman Tambah User|</legend>

<div id="contentform" style="border:solid thin #BBBBBB; height:350px; background-color:#F9F9F9; -moz-border-radius: 5px;  padding-top:10px; padding-bottom:0.3px; margin-right:100px; margin-left:100px;">

<!-- Start value -->
<?
    //Setting Value Jika Prosedur yang dilakukan adalah prosedur input biasa.
	$value = array(
		'baru'					=> "",
		'id_user'				=> "",
		'nama'					=> "",
		'username'				=> "",
		'password'				=> "",
		'role_id'				=> "",
		'email'					=> "",
		'no_hp'					=> "",
		'act_form'				=> "user/add/"
	);
	
	//Setting Value pada form Jika melakukan prosedur Edit terhadap data tertentu.
	if($status == "edit"){
			$value['baru'] = "baru";
			$value['id_user'] = $id_user;
			$value['nama'] = $nama;
			$value['username'] = $username;
			$value['password'] = $password;
			$value['role_id'] = $role_id;
			$value['email'] = $email;
			$value['no_hp'] = $no_hp;
			$value['act_form'] = "user/update/".$value['id_user'];
	}//end if
?>
<?= form_open($value["act_form"]); ?>
<!-- End value -->

<table width="847" border="0" bordercolor="#F0F0F0">
  <tr>
    <td width="905" height="150">
        <form id="form1" name="form1" method="post">
          <div align="center">
            <table width="850" border="0">
			  <tr>
                <td width="80">Nama</td>
                <td width="208"><input name="nama" type="text" size="30" value="<?=$value['nama']?>"/></td>
                <td width="400"><? echo form_error('nama');?></td>
              </tr>
              <tr>
                <td width="80">Username</td>
                <td width="208"><input name="username" type="text" size="30" value="<?=$value['username']?>"/></td>
                <td width="400"><? echo form_error('username');?></td>
              </tr>

              <?
                if($status == "edit"){
                    echo'
                        <tr>
                            <td width="80">Password Lama</td>
                            <td width="208"><input name="konfirm_password" type="PASSWORD" size="30" value=""/></td>
                          </tr>
                        ';
                }

              ?>
              
              <tr>
                <td width="80">Password <?=$value['baru']?></td>
                <td width="208"><input name="password" type="password" size="30" value=""/></td>      	       
                <td width="400"><? echo form_error('password');?></td>
              </tr>
              
              <tr>
                <td width="80">Konfirmasi password</td>
                <td width="208"><input name="password_konfirm" type="password" size="30" value=""/></td>
                <td width="400"><? echo form_error('password_konfirm');?></td>
              </tr>
			  
			  <tr>
                                        <td width="80">Jabatan</td>
										<td width="208">
										<?php 
											$pilihan_jk = array(
											Null => '-- Pilih Jabatan --',
											'2' => 'Admin',
											'3' => 'Kepala Departemen',
											'4' => 'Karyawan'
											);
											
											if ($status == "edit"){
											echo form_dropdown('role_id',$pilihan_jk,$role_id, 'class="field select"');
											}
											else {
											echo form_dropdown('role_id',$pilihan_jk,  'class="field select"');
											}
										
										?>
										</td>
										<td><? echo form_error('role_id');?></td>
			  </tr>
			  
			 
			  <tr>
                <td width="80">Email</td>
                <td width="208"><input name="email" type="text" size="30" value="<?=$value['email']?>"/></td>
                <td width="400"><? echo form_error('email');?></td>
              </tr>
			  <tr>
                <td width="80">No. hp</td>
                <td width="208"><input name="no_hp" type="text" size="30" value="<?=$value['no_hp']?>"/></td>
                <td width="400"><? echo form_error('no_hp');?></td>
              </tr>
                
                
              <tr>
                <td height="28">&nbsp;</td>
                <td>
                  <div align="left">
                    <input type="submit" name="Submit" value="Simpan" />
                    </div></td>
              </tr>
            </table>
          </div>
      </form>        
      <p align="center">&nbsp;</p></td></tr>
</table>
</div>
<p>&nbsp;</p>
</fieldset>
</div> 
<p>
  <!--container-->
</p>
<p>&nbsp; </p>
